.block
  %h3 Sidebar
  .content
    %p Audit Cycle
    =form_for((@cycle || Cycle.new), :url => slugfilter_cycle_update_path(:format => :js) , :html => { :class => :form, :remote => true }) do |f|
      =f.collection_select :id, Cycle.order(:start_at), :id, :display_name, :include_blank => true
      =f.submit "Show", :class => :button

    %p Filter by Program
    =form_for((@program || Program.new), :url => slugfilter_program_update_path(:format => :js) , :html => { :class => :form, :remote => true }) do |f|
      =f.collection_select :id, Program.all, :id, :display_name, :include_blank => true
      =f.submit "Show", :class => :button

    %p Default Company
    =form_for((@program || Program.new), :url => slugfilter_company_update_path(:format => :js) , :html => { :class => :form, :remote => true }) do |f|
      =f.collection_select :id, Program.where(:company => true).all, :id, :display_name, :include_blank => true
      =f.submit "Show", :class => :button

    %p Filter Controls by Slug
    =form_tag slugfilter_slug_update_path(:format => :js), :class => :form, :remote => true do
      =text_field_tag :slugfilter, session[:slugfilter], :class => 'text_field'
      =submit_tag "Filter", :class => :button
      =submit_tag "Clear", :name => :clear, :class => :button
    :javascript
      $(document).ready(function() {
        $("input#slugfilter").autocomplete({
          source: "#{url_for(:controller => "/slugfilter", :action => :values, :format => :js)}",
          minLength: 0,
        });
      });
